using System;
using System.Collections.Generic;

namespace CMS.Core.Domain
{
    /// <summary>
    /// DonThuVBCD object for NHibernate mapped table DonThuVBCD.
    /// </summary>
    [Serializable]
    public class DonThuVBCD : DomainObject<DonThuVBCD.DomainObjectID>
    {

        [Serializable]
        public class DomainObjectID
        {
            public DomainObjectID() { }

            private System.String _MaDonThu;
            private System.Int32 _MaVanBan;

            public DomainObjectID(System.String maDonThu, System.Int32 maVanBan)
            {
                _MaDonThu = maDonThu;
                _MaVanBan = maVanBan;
            }

            public System.String MaDonThu
            {
                get { return _MaDonThu; }
                protected set { _MaDonThu = value; }
            }

            public System.Int32 MaVanBan
            {
                get { return _MaVanBan; }
                protected set { _MaVanBan = value; }
            }


            public override bool Equals(object obj)
            {
                if (obj == this) return true;
                if (obj == null) return false;

                DomainObjectID that = obj as DomainObjectID;
                if (that == null)
                {
                    return false;
                }
                else
                {
                    if (this.MaDonThu != that.MaDonThu) return false;
                    if (this.MaVanBan != that.MaVanBan) return false;

                    return true;
                }

            }

            public override int GetHashCode()
            {
                return MaDonThu.GetHashCode() ^ MaVanBan.GetHashCode();
            }

        }

        private DonThu _DonThu;
        private VanBan _VanBan;

        public DonThuVBCD()
        {
            
        }

        public DonThuVBCD(DomainObjectID id)
        {
            base.ID = id;
        }

        public virtual System.String MaDonThu
        {
            get { return base.id.MaDonThu; }
        }

        public virtual System.Int32 MaVanBan
        {
            get { return base.id.MaVanBan; }
        }

        public virtual DonThu DonThu
        {
            get { return _DonThu; }
            set { _DonThu = value; }
        }

        public virtual VanBan VanBan
        {
            get { return _VanBan; }
            set { _VanBan = value; }
        }

        public override int GetHashCode()
        {
            return ID.GetHashCode();
        }
    }
}
